package com.example.mobile2121606109ycg0407;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button btnMainTip1;
    private Button btnMainTip2;
    private Button btnMainTip3;
    private Button btnMainTip4;
    private Button btnMainTip5;
    private Button btnMainTip6;
    private Button btnMainTip7;
    private Button btnMainTip8;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();

        //调用
        btnMainTip1.setOnClickListener(this);
        btnMainTip2.setOnClickListener(this);
        btnMainTip3.setOnClickListener(this);
        btnMainTip4.setOnClickListener(this);
        btnMainTip5.setOnClickListener(this);
        btnMainTip6.setOnClickListener(this);
        btnMainTip7.setOnClickListener(this);
        btnMainTip8.setOnClickListener(this);
    }

    private void initView() {
        btnMainTip1 = (Button) findViewById(R.id.btnMainTip1);
        btnMainTip2 = (Button) findViewById(R.id.btnMainTip2);
        btnMainTip3 = (Button) findViewById(R.id.btnMainTip3);
        btnMainTip4 = (Button) findViewById(R.id.btnMainTip4);
        btnMainTip5 = (Button) findViewById(R.id.btnMainTip5);
        btnMainTip6 = (Button) findViewById(R.id.btnMainTip6);
        btnMainTip7 = (Button) findViewById(R.id.btnMainTip7);
        btnMainTip8 = (Button) findViewById(R.id.btnMainTip8);
    }
//其他Activity的按钮跳转
    @Override
    public void onClick(View view) {
        Intent intent = new Intent();
        switch (view.getId()) {
            case R.id.btnMainTip1:
                intent.setClass(MainActivity.this, MainActivityTip1.class);
               startActivity(intent);
               break;
            case R.id.btnMainTip2:
                intent.setClass(MainActivity.this, MainActivityTip2.class);
                startActivity(intent);
                break;
            case R.id.btnMainTip3:
                intent.setClass(MainActivity.this, MainActivityTip3.class);
                startActivity(intent);
                break;
            case R.id.btnMainTip4:
                intent.setClass(MainActivity.this, MainActivityTip4.class);
                startActivity(intent);
                break;
            case R.id.btnMainTip5:
                intent.setClass(MainActivity.this, MainActivityTip5.class);
                startActivity(intent);
                break;
            case R.id.btnMainTip6:
                intent.setClass(MainActivity.this, MainActivityTip6.class);
                startActivity(intent);
                break;
            case R.id.btnMainTip7:
                intent.setClass(MainActivity.this, MainActivityTip7.class);
                startActivity(intent);
                break;
            case R.id.btnMainTip8:
                intent.setClass(MainActivity.this, MainActivityTip8.class);
                startActivity(intent);
                break;
        }
    }
}